import request from '@/utils/request'

const baseURL = '/api/section'

export function getAllSection() {
  return request({
    url: baseURL + '/sectionList',
    method: 'get',
  })
}

export function getSectionList({
                                 page, pageSize, params = {}, data
                               }) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getOneSection(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addSection(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateSection(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneSection(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete'
  })
}
